<div>
    <div class="eChart-div">
        <div id="pay_pie" style="width: 49%;height: 400px"></div>
        <div id="worker_bar" style="width: 49%;height: 400px"></div>
    </div>
    <div class="canvas_space marginT_5"></div>
    <div class="eChart-div">
        <div id="goods_bar" style="width: 100%;height: 400px"></div>
    </div>
</div>

<script type="text/javascript">
    var shopGoods = JSON.parse('{!! $shopGoods !!}');// 水桶品牌
    var worker = JSON.parse('{!! $worker !!}');// 送水工
    var payType = JSON.parse('{!! $payType !!}');//支付方式统计

    // 水桶品牌统计
    var shopGoodsBar = {
        id:'goods_bar',
        title: '商品统计/桶',
        legend: ['送水数量'],
        category:[],
        series: {
            0:[]
        }
    };

    $.each(shopGoods, function(i,val){
        shopGoodsBar.category.push(val.goods_name)
        shopGoodsBar.series[0].push(parseInt(val.total_num));
    });

    // 送水工统计
    var workerBar = {
        id:'worker_bar',
        title:'送水工统计/桶',
        legend: ['送水数','回桶数'],
        category:[],
        series:{
            0:[],
            1:[]
        }
    };
    $.each(worker, function (i,val) {
        workerBar.category.push(val.name)
        workerBar.series[0].push(parseInt(val.total_num))
        workerBar.series[1].push(parseInt(val.total_back_num))
    })

    // 支付方式统计
    var payPie = {
        id:'pay_pie',
        title:'支付方式统计/桶',
        name:'总配送数：'+payType.total_all_num,
        legend: ['微信支付','水票支付','货到付款'],
        series:[
            {value:parseFloat(payType.total_online_num),name:'微信支付'},
            {value:parseFloat(payType.total_bill_num),name:'水票支付'},
            {value:parseFloat(payType.total_offline_num),name:'货到付款'}
        ]
    }

    $(function(){
        canvasBar(shopGoodsBar)
        canvasBar(workerBar)
        canvasPie(payPie)
    });
</script>
